imwayland: Fix clearing of preedit text in webkitgtk
authorDorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Tue, 11 Sep 2018 12:12:28 +0000 (12:12 +0000)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 18 Dec 2018 19:27:12 +0000 (20:27 +0100)
Fixes webkitgtk misbehaviour as outlined in https://gitlab.gnome.org/GNOME/gtk/issues/1316#note_312942 , which was introduced in 49b17e6c.
The preedit will be cleared on exit only if it is already present.

gtk/gtkimcontextwayland.c

index 13eea1b40716f1984604284fe391c8c3205fe7cf..ee9902fa2114d77f6b58ee2e0e67726be11fc85d 100644 (file)
@@ -638,8 +638,11 @@ gtk_im_context_wayland_focus_out (GtkIMContext *context)
   commit_state (context_wayland);
 
   /* after disable, incoming state changes won't take effect anyway */
-  text_input_preedit (global, global->text_input, NULL, 0, 0);
-  text_input_preedit_apply (global);
+  if (context_wayland->current_preedit.text)
+    {
+      text_input_preedit (global, global->text_input, NULL, 0, 0);
+      text_input_preedit_apply (global);
+    }
 
   global->current = NULL;
 }